package com.allscore.demo.boot.nacos.controller;

import com.allscore.demo.boot.nacos.api.User;
import com.allscore.demo.boot.nacos.config.CmmConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Administrator
 */
@RefreshScope
@RestController
public class PorviderController {

    @Autowired
    private CmmConfig cmmConfig;

    @PostMapping("/getUser")
    public User getUser() {
        User u = new User();
        u.setId(cmmConfig.getId());
        u.setName(cmmConfig.getName());
        System.out.println(u.toString());
        return u;
    }
}
